- /* sdmstint.cpp by K.Tsuru */
- // function ID = 308 DRADIX, BRADIX
- // I changed it can treat number larger than BRADIX since ver 2.18.
- /********************************************************
- SDouble and SDecimal class
- It sets a short value.
- Usually "m=v" is all right. Please use in a large roop.
- ********************************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
-
-
- void SDouble::SetInt(int v){
- static const int F_SIZE = howdigsrdx(INT_MAX, DRADIX);
- static int* F = new int[F_SIZE];
-
- SetZero();
- // if(F_SIZE > minArraySize) Reserve(F_SIZE + 1); // 64 bits system
- if(v == 0) return;
-
- int absV = abs(v);
-
- SetSign(v);
- if(Type() == BIN_DEC){
- //for 32 bits system(always false in 16 bits system)
- if((double)absV >= BRADIX) SetError(OUT_OF_RANGE,"SD SetInt",308);
- figure[0] = (fType)absV;
- return;
- }
-
- int n = rdxconv(F, v, DRADIX);
-
- rdxExp = n; aTail = 1;
-
- int i, j;
-
- for(i = 1, j = n - 1 ; i <= n; i++, j--) {
- figure[i] = F[j];
- }
- for(i = n; figure[i] == 0; i--);
- aHead = i;
-
- /*
- if(absV < (int)DRADIX){
- figure[1] = (fType)absV;
- aHead = aTail = 1; rdxExp = 1;
- }else{
- figure[1] = fType(absV / (int)DRADIX);
- figure[2] = fType(absV % (int)DRADIX);
- aTail = 1; aHead = figure[2] ? 2 : 1;
- rdxExp = 2;
- }
- */
- }
sdmstint.cpp : last modifiled at 2017/03/13 14:31:58(1,320 bytes)
created at 2017/10/07 10:21:14
The creation time of this html file is 2017/10/07 10:30:03 (Sat Oct 07 10:30:03 2017).